// ================================================================================
// 		File: PartyVolunteerActivitieMember.cs
// 		Desc: 
//  
// 		Called by:   
//               
// 		Auth: chenwenzhi（）
// 		Date: 2016-04-01 22:01
// ================================================================================
// 		Change History
// ================================================================================
// 		Date:		Author:				Description:
// 		--------	--------			-------------------
//    
// ================================================================================
// 
// ================================================================================
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using ZHDJ.Core;

namespace ZHDJ.Data.Models.Center
{
    /// <summary>
    /// 志愿活动参与人员
    /// </summary>   
    public class PartyVolunteerActivitieMember : EntityBase
    {
        #region 属性

        /// <summary>
        /// 志愿活动ID
        /// </summary>
        public string ActivitieID { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public string LoginID { get; set; }

        /// <summary>
        /// 状态( 1邀请或者申请，2确认参加，3请假，4,签到，5实际参加 )
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 是否邀请用户（申请用户无2、3状态）
        /// </summary>
        public string IsInvite { get; set; }

        /// <summary>
        /// 人员审核时间（状态，2或3时修改）
        /// </summary>
        public DateTime? AduitTime { get; set; }

        #endregion

        #region 查询管理

        public static DataTable GetGridData(string activiteId)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@"select a.LoginID,UserName,a.Status from tblpartyvolunteeractivitiemember a
                        left join tblpartyorgmember m on a.LoginID=m.LoginID
                        where ActivitieID='" + activiteId + "'");

            return MySqlHelper.ExecuteDataTable(sb.ToString());
        }

        public static void UpdateMemberStatus(string activiteId, string loginId)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@"update tblpartyvolunteeractivitiemember set Status=2 where ActivitieID='" + activiteId + "' and LoginID='" + loginId + "'");

            MySqlHelper.ExecuteNonQuery(sb.ToString());
        }
        #endregion
    }
}
